<?php
	/*
	file ini digunakan untuk mengontrol login apakah user telah sesuai prosedur masuk aplikasi
	*/
class utama extends CI_Controller {

	function __construct(){
		parent::__construct();
		session_start();
		$this->load->model('m_berita');
	}//end Login

	function index(){
          $this->corporate();
	}

	function corporate(){
		$_SESSION[SESSION_PAGE]=1;

		$data["leftpage"]=$this->get_leftpage();
		$data["centerpage"]=$this->get_centerpage();
		$data["rightpage"]=$this->get_rightpage();
		$data["hl"]=$this->get_highlightpage();

		$this->load->view('v_utama', $data);
	}

	function social(){
		$_SESSION[SESSION_PAGE]=3;

		$data["leftpage"]=$this->get_leftpage();
		$data["centerpage"]=$this->get_centerpage();
		$data["rightpage"]=$this->get_rightpage();
		$data["hl"]=$this->get_highlightpage();
		$this->load->view('v_social', $data);
	}

	function investor(){
		$_SESSION[SESSION_PAGE]=2;

		$data["leftpage"]=$this->get_leftpage();
		$data["centerpage"]=$this->get_centerpage();
		$data["rightpage"]=$this->get_rightpage();
		$data["hl"]=$this->get_highlightpage();
		$this->load->view('v_investor', $data);
	}

	function get_highlightpage(){

		$data["hl"]=$this->m_public_function->get_highlightpage();

		$hlpage=$this->load->view('v_highlight', $data, TRUE);
		return $hlpage;
	}

	function get_leftpage(){

		$data["title"]="Awards";
		$data["awards"]=$this->m_public_function->get_awards_page();
		$leftpage=$this->load->view('v_awards', $data, TRUE);
		return $leftpage;

	}

	function get_centerpage(){

		$data["bankaltimedia"]=$this->m_berita->berita_terbaru(6);
		$data["news"]=$this->m_berita->pengumuman_terbaru(6);
		$centerpage=$this->load->view('v_centerpage', $data, TRUE);
		return $centerpage;

	}

	function get_rightpage(){

		if($_SESSION[SESSION_PAGE]==1){
			$data["title"]="Promotions";
			$data["promotions"]=$this->m_public_function->get_promotions_page();
			$rightpage=$this->load->view('v_promotions', $data, TRUE);
		}else if($_SESSION[SESSION_PAGE]==2 || $_SESSION[SESSION_PAGE]==3){
			$data["title"]="Investor Relations";
			$data["epage"]=$this->m_public_function->get_page('investors');
			$rightpage=$this->load->view('v_epage', $data, TRUE);
		}

		return $rightpage;

	}
}
?>
